package com.arelikebrothers.demo.spring.aop.hello;

import org.springframework.aop.framework.ProxyFactory;

/**
 * Created by lennon on 27/05/2017.
 */
public class TestGreetingBeforeAdvice {
    public static void main(String[] args) {
        Waiter waiter = new WaiterImpl();
        GreetingBeforeAdvice advice = new GreetingBeforeAdvice();

        ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.setTarget(waiter);
        proxyFactory.addAdvice(advice);

        Waiter proxy = (Waiter) proxyFactory.getProxy();
        proxy.greetTo("lennon");
        proxy.serveTo("wsy");

    }
}
